import { addBaseBlock } from "../blocks/basic/addBaseBlock";
import { addTimeType } from "../blocks/basic/addTimer";
import { addSelection } from "../blocks/basic/addSelection"
import { addVideoPlayerComponent } from "../blocks/basic/addVideoPlayerComponent";
import{addScrollableBoxComponent}from "../blocks/basic/addScrollableBoxComponent";
import{addPaginationComponent}from "../blocks/basic/addPaginationComponent";
import { addTag } from "../blocks/basic/addTag";
export const BasicBlockManager = (editor) => {
  // ------------------------------------------------------------------------------------------------------------
  /*
    Baseblock组件
  */
  const config = {
    // 需要添加的blcoks
    blocks: [
      "column1",
      "column2",
      "column3",
      "column3-7",
      "text",
      "link",
      "image",
    ],
    // 将flexbox用于网格
    flexGrid: true,
    // Class类的前缀
    stylePrefix: "gjs-",
    // 对blocks使用基本CSS
    addBasicStyle: true,
    category: "Basic",
    // 以下为标签名
    labelColumn1: "1 Column",
    labelColumn2: "2 Columns",
    labelColumn3: "3 Columns",
    labelColumn37: "2 Columns 3/7",
    labelText: "Text",
    labelLink: "Link",
    labelImage: "Image",
    labelVideo: "Video",
    labelMap: "Map",
    // 初始行高
    rowHeight: 75,
    // ...opts,
  };
  addBaseBlock(editor, config);
  addTimeType(editor);
  addVideoPlayerComponent(editor);
  addScrollableBoxComponent(editor);
  addPaginationComponent(editor);
  addSelection(editor);
  addTag(editor);
  editor.Blocks.add("iframe", {
    label: "iframe",
    media: `<svg style="width:30px;height:30px" viewBox="0 0 24 24">
        <path d="M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z" />
    </svg>`,
    activate: true,
    draggable: true,
    select: true,
    category: "Basic",
    resizable: true,
    content: {
      content:
        '<div class="iframe-container" style="width:100%;height:100%"><iframe style="width:100%;height:100%" class="iframe" src="http://localhost:8080/#/Main/CommodityList"></iframe></div>',
    },
  });
}